package niuke;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

/**
 * @author cyt
 * @create 2020-05-22 9:03
 */
public class C {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            String ans = sc.nextLine();
            String remove = remove(ans);

            System.out.println(remove);
        }

    }

    static String remove(String s) {
        if (s.length() < 2) {
            return s;
        }
        HashMap<Character, Integer> map = new HashMap<>();
        char[] chars = s.toCharArray();
        ArrayList<Integer> integerArrayList = new ArrayList<>();
        int temp = -1;
        ll:
        for (int i = 0; i < chars.length - 1; i++) {
            if (map.containsKey(chars[i])) {
                if (chars[i] >= temp) {
                    integerArrayList.add(i);
                    continue ll;
                }
            } else {
                integerArrayList.add(map.get(chars[i]));
                map.put(chars[i], i);
                continue ll;
            }
            map.put(chars[i], i);
            temp = chars[i];
        }
        for (Integer integer : integerArrayList) {
            chars[integer] = '-';
        }
        String str = new String(chars);
        return str.replaceAll("-", "");
    }
}
